<template>
  <p-form-model :model="form" :rules="rules" layout="inline">
    <p-form-model-item label="线索编号">
      <p-input v-model="form.leadsNo" placeholder="请输入" />
    </p-form-model-item>
    <p-form-model-item label="线索名称">
      <p-input v-model="form.leadsName" placeholder="请输入" />
    </p-form-model-item>
    <p-form-model-item label="当前状态">
      <SelectDefault
        v-model="form.currStatus"
        code="leads_transfer_biz_process_status"
      />
    </p-form-model-item>
    <p-form-model-item label="当前节点">
      <SelectDefault v-model="form.nodeCode" :options="node" />
    </p-form-model-item>
    <p-button class="btn-search" @click="handleReset">重置</p-button>
    <p-button type="primary" @click="handleSearch">
      搜索
    </p-button>
  </p-form-model>
</template>
<script>
import { getDicList } from '@/api/public.js';
const defaultForm = {
  leadsNo: undefined,
  leadsName: undefined,
  currStatus: undefined,
  nodeCode: undefined,
};
export default {
  data() {
    return {
      node: [],
      form: {
        ...defaultForm,
      },
    };
  },
  created() {
    this.getDicList();
  },
  methods: {
    async getDicList() {
      const res = await getDicList('leads_transfer_biz_process_node');
      const nodeOption = res?.data?.data || [];
      this.node = [
        { label: '全部', value: '' },
        ...nodeOption.filter(item => item.sort !== 1),
      ];
    },
    handleSearch() {
      this.$emit('search', this.form);
    },
    handleReset() {
      this.form = { ...defaultForm };
      this.$emit('search', this.form);
    },
  },
};
</script>

<style lang="less" scoped>
.poros-form {
  box-sizing: border-box;
  background-color: #f7f7f8;
  padding: 10px;
  padding-bottom: 0px;
  width: 100%;
}
.poros-form-item {
  width: 20%;
  margin-bottom: 10px;
}
/deep/ .poros-form-item-control-wrapper {
  width: calc(100% - 70px);
}
.btn-search {
  margin-right: 16px;
}
/deep/ .poros-form-item-label {
  width: 70px;
}
</style>
